﻿@model CustomerAddressListModel
@using Nop.Web.Models.Customer;
@{
    Layout = "~/Views/Shared/_ColumnsTwo.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Account").Text);
}
@section left
{
    @Html.Action("CustomerNavigation", "Customer", new { selectedTabId = CustomerNavigationEnum.Addresses })
}


<div class="features_items my-account-page"><!--features_items-->
    <h2 class="title text-center">@T("Account.MyAccount") - @T("Account.CustomerAddresses")</h2>
    <div class="custom-page-box-div">
        @if (Model.Addresses.Count > 0)
        {
            for (int i = 0; i < Model.Addresses.Count; i++)
            {
                var address = Model.Addresses[i];
                    
                <div class="section address-item">
                    <div id="legend">
                        <legend>@address.FirstName @address.LastName</legend>
                    </div>
                    <ul class="info">
                        <li class="name">
                            @address.FirstName @address.LastName
                        </li>
                        <li class="email">
                            @Html.LabelFor(model => model.Addresses[i].Email, new { }, ":")
                            @address.Email
                        </li>
                        @if (address.PhoneEnabled)
                        {
                            <li class="phone">
                                @Html.LabelFor(model => model.Addresses[i].PhoneNumber, new { }, ":")
                                @address.PhoneNumber
                            </li>
                        }
                        @if (address.FaxEnabled)
                        {
                            <li class="fax">
                                @Html.LabelFor(model => model.Addresses[i].FaxNumber, new { }, ":")
                                @address.FaxNumber
                            </li>
                        }
                        @if (address.CompanyEnabled && !String.IsNullOrEmpty(address.Company))
                        {
                            <li class="company">@address.Company</li>
                        }
                        @if (address.StreetAddressEnabled)
                        {
                            <li class="address1">
                                @address.Address1
                            </li>
                        }
                        @if (address.StreetAddress2Enabled && !String.IsNullOrEmpty(address.Address2))
                        {
                            <li class="address2">
                                @address.Address2
                            </li>
                        }
                        @if (address.CityEnabled || address.StateProvinceEnabled || address.ZipPostalCodeEnabled)
                        {
                            <li class="city-state-zip">
                                @if (address.CityEnabled)
                                {
                                    @address.City
                                }
                                @if (address.CityEnabled && (address.StateProvinceEnabled || address.ZipPostalCodeEnabled))
                                {
                                    <text>,</text>
                                }
                                @if (address.StateProvinceEnabled)
                                {
                                    @address.StateProvinceName
                                }
                                @if (address.ZipPostalCodeEnabled)
                                {
                                    @address.ZipPostalCode
                                }
                            </li>
                        }
                        @if (address.CountryEnabled && !String.IsNullOrEmpty(address.CountryName))
                        {
                            <li class="country">
                                @address.CountryName
                            </li>
                        }
                    </ul>
                    <div class="buttons left">
                        <input type="button" class="button-2 edit-address-button btn btn-primary" onclick="location.href='@(Url.RouteUrl("CustomerAddressEdit", new { addressId = address.Id }))'" value='@T("Common.Edit")' />
                        <input type="button" class="button-2 delete-address-button btn btn-primary" onclick="if (confirm('@(T("Common.AreYouSure").Text)')) {location.href='@(Url.RouteUrl("CustomerAddressDelete", new { addressId = address.Id }))';}" value="@T("Common.Delete")" />
                    </div>
                </div>
                <div class="space15px"></div>
                <div id="legend">
                    <legend></legend>
                </div>

            }
        }
        else
        {
            @T("Account.CustomerAddresses.NoAddresses")
        }
        
        
        <div class="row">
            <div class="col-sm-12">
                <div class="add-button">
                    <input type="button" class="button-1 add-address-button btn btn-primary pull-right" onclick="location.href='@Url.RouteUrl("CustomerAddressAdd")'" value="@T("Common.AddNew")" />
                </div>
            </div>
        </div>
        
    </div>
</div>




@*


<div class="col-sm-9">
    <div class="blog-post-area">
        <h2 class="title text-center">@T("Account.MyAccount") - @T("Account.CustomerAddresses")</h2>
    </div>
    <div class="panel-body">
        <div class="address-list">
            
        </div>
        
    </div>
</div>
*@
